<?php
class PaymentApprovalDepositForm extends BaseInvoicePaymentForm{

	function configure(){
		$this->useFields(array("amount","status_id"));
		if($this->getObject()->getPaymentStatus()->getCode()!=PaymentStatusTable::STATUS_PENDING){
			throw new Exception(sprintf("este pago ya ha sido '%s' por '%s'",$this->getObject()->getPaymentStatus()->getName(), $this->getObject()->getUserApproved()->getFullname()));
		}
		$this->getObject()->setApprovedBy(sfContext::getInstance()->getUser()->getGuardUser()->getUser());
		$statuses=array(PaymentStatusTable::getInstance()->findOneByCode(PaymentStatusTable::STATUS_APPROVED)->getId()=>"Aprobar",
					  PaymentStatusTable::getInstance()->findOneByCode(PaymentStatusTable::STATUS_REJECTED)->getId()=>"Rechazar");
		$this->widgetSchema["status_id"]= new sfWidgetFormChoice(array("choices"=>$statuses,"expanded"=>true),array("class"=>"inlist"));
		
	}
}